// ValidationAspects
// Written by Mike Saunders
// Released under Microsoft Public License (Ms-PL)
using System;
using System.ComponentModel;
using PostSharp.Extensibility;
using PostSharp.Laos;

namespace WpfStateValidation
{
	[Serializable]
	[AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Class, AllowMultiple = false, Inherited = false)]
	[MulticastAttributeUsage(MulticastTargets.Class, AllowMultiple = false)]
	public class DataErrorInfoAttribute : CompositionAspect
	{
		#region Overrides of CompositionAspect
		public override object CreateImplementationObject(InstanceBoundLaosEventArgs eventArgs)
		{
			return new DataErrorInfoImpl(eventArgs.Instance);
		}

		public override Type GetPublicInterface(Type containerType)
		{
			return typeof(IDataErrorInfo);
		}

		public override CompositionAspectOptions GetOptions()
		{
			return CompositionAspectOptions.GenerateImplementationAccessor;
		}
		#endregion
	}
}